package runner.PSO_VM;

import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.power.PowerHost;
import runner.jswarm_pso.Particle;

import java.util.List;
import java.util.Random;

public class SchedulerParticle extends Particle {

    SchedulerParticle(List<Vm> vmList, List<PowerHost> hostList) {
        super(vmList.size());
        double[] position = new double[vmList.size()];
        double[] velocity = new double[vmList.size()];

        for (int i = 0; i < vmList.size(); i++) {
            Random randObj = new Random();
            position[i] = randObj.nextInt(hostList.size());
            velocity[i] = Math.random();
        }
        setPosition(position);
        setVelocity(velocity);
    }

}
